package de.graph.common.impl;

import java.util.Set;

import de.graph.common.Edge;
import de.graph.common.Vertex;
import de.graph.document.Document;

final class VertexImpl extends ElementImpl implements Vertex {

    private static final long serialVersionUID = -470144655756848158L;

    protected static final String IN_EDGES = "inEdges";

    protected static final String OUT_EDGES = "outEdges";

    protected VertexImpl(final Document document) {
        super(document);
    }

    public Set<Edge> getOutEdges() {
        return getProperty(OUT_EDGES);
    }

    public Set<Edge> getInEdges() {
        return getProperty(IN_EDGES);
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();

        builder.append("vertex(");
        builder.append((getLabel().length() > 0) ? getLabel() : hashCode());
        builder.append(")");

        return builder.toString();
    }
}
